# cat("hello R cat!",file = "./test.txt",append = T)
#
# sink("./test.txt")
# sink()
# for (i in 1:5)
#   print(i)
# readLines("./test.txt")

# #solve
# # 定义系数矩阵 A
# A <- matrix(c(3, 4, 2, -1), nrow = 2, byrow = TRUE)
#
# # 定义常数项向量 B
# B <- c(5, 1)
#
# # 解方程组
# x <- solve(A, B)
#
# # 打印解
# print(x)

x <- 50L
if(is.integer(x)) {
  print("X 是一个整数")
}

x <- c("google","runoob","taobao")

if("runoob" %in% x) {
  print("包含 runoob")
} else {
  print("不包含 runoob")
}

if("weibo" %in% x) {
  print("第一个 if 包含 weibo")
} else if ("runoob" %in% x) {
  print("第二个 if 包含 runoob")
} else {
  print("没有找到")
}

x <- c("google","runoob","taobao")

x <- switch(
  3,
  "google",
  "runoob",
  "taobao",
  "weibo"
)
print(x)

you.like<-"runoob"
switch(you.like, google="www.google.com", runoob = "www.runoob.com", taobao = "www.taobao.com")

x <- switch(4,"google","runoob","taobao")
x
x <- switch(4,"google","runoob","taobao")
x
